package 状态机.请假demo.handler.impl.annualleavespecifichandler.leader;


import 状态机.请假demo.entity.LeavePermit;
import 状态机.请假demo.handler.CommonStatusHandler;

public class LeaderPermittingAnnualLeavePermitStatusHandler extends CommonStatusHandler {

    @Override
    protected void doSpecificHandler(LeavePermit leavePermit) {
        System.out.println(String.format("user:%s--Leader审批%s中--leavePermit.status is:%s",
                leavePermit.getUser(),
                leavePermit.getLeavePermitType().getMemo(),
                leavePermit.getStatus().getStatus()));

    }

    @Override
    public void after(LeavePermit leavePermit) {
        if (leavePermit.getEvent() == null) {
            // 还未审批，状态机结束，等待审批意见
            System.out.println(String.format("user:%s--等待Leader审批--leavePermit.status is :%s",
                    leavePermit.getUser(),
                    leavePermit.getStatus().getStatus()));

            return;
        }

        // 执行父类方法的状态转移代码即可
        goNextStatusHandler(leavePermit);
    }

}
